<?php
include 'checkLogin.php';

@$id = $_REQUEST['id'];
@$priceType= $_REQUEST['priceType'];

@$stockPrice = $_REQUEST['stockPrice'];
@$sellPrice = $_REQUEST['sellPrice'];

include 'db/li.php';

if(!empty($stockPrice)){
	@$flog = dbUpdate("update goods set stockPrice=$stockPrice where id=:id",array('id'=>$id));
	flog($flog);
}
if(!empty($sellPrice)){
	@$stockPrice2 = dbSelect('select stockPrice from goods where id=:id',array('id'=>$id));
	if($stockPrice2['stockPrice'] > $sellPrice){
		$mes = '售价低于成本，请重新定价';
		include 'updatePrice.php';
		die;
	}else{
		@$flog = dbUpdate("update goods set sellPrice=$sellPrice where id=:id",array('id'=>$id));
		flog($flog);
	}
}
function flog($flog){
	if(!$flog){
		$mes = '修改失败';
		include 'updatePrice.php';
		die;
	}
	header('Refresh:0;url=goodsList.php?listType=price');
}
